<?php
list($app_id, $access_token, $sitemid, $time, $key, $request_ids, $is_install) = require_once 'inc.php';
?>
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title> 都市漂流瓶 </title>
<link rel="stylesheet" type="text/css" href="./public/bottle.css" />
<script type="text/javascript" src="./public/prototype.js?3"></script>
<script type="text/javascript" src="./public/library.js?1"></script>
<script type="text/javascript" src="./public/bottle2.js?8"></script>
<script src="http://connect.facebook.net/zh_TW/all.js"></script>
<style type="text/css">
.hidden { display: none; }
</style>
<script>
var	app_id			= '<?php echo $app_id ?>',
	access_token		= '<?php echo $access_token ?>',
	sitemid				= '<?php echo $sitemid ?>',
	time					= '<?php echo $time ?>',
	key					= '<?php echo $key ?>',
	request_ids		= <?php echo $request_ids ?>,
	install				= '<?php echo $is_install ?>',
	// rpc_host			= '/g-bottle/?',
	rpc_host			= '/bend/?',
	fql_url				= 'https://api.facebook.com/method/fql.query',
	graph_url			= 'https://graph.facebook.com/';
</script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-20316968-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</head>

<div class="container" id="bottle_container">

	<div id="btlmask" class="bottle_mask hidden"></div>
	<div class="bottle_head">
		<p class="bottle_desc">&nbsp; &nbsp; 漂流瓶, 寂寞都市的傾訴工具</p>
	</div>
	<div id="loading" class="bottle_loading">
		<img src="public/imgs/loading_cover02340f.gif" />
		<p class="b_size">很快到海灘了，請耐心等待…</p>
	</div>

	<div id="bottle_all" class="bottle_box bottle_list hidden"></div>
	<div id="bottle_fetch" class="bottle_fetch hidden"></div>
	<div id="bottle_send"
		class="bottle_box bottle_paper bottle_send hidden">
	</div>

	<div id="toolbar" class="bottle_toolbar hidden">
		<div class="toolbar_wrap">
			<a href="javascript:void(0);" act="WineCooler" ck="clk" class="icon btnThrow"> </a>
			<a href="javascript:void(0);" act="Pick" ck="clk" class="icon btnGet"> </a>
		</div>
	</div>

	<div id="bottle_tipsbox"
		class="bottle_box bottle_tips hidden">
	</div>
	<div id="bottle_interactive"
		class="bottle_box bottle_interactive hidden">
	</div>
	<div id="bottle_sendsuccess"
		class="bottle_box bottle_tips hidden">
	</div>
</div>

<div id="fb-root"></div>
<div id="json_rpc-root"></div>
<script>
var fbu_info = false;
function load_init(f) {
	if(f == 0 && document.readyState != "complete")
		return;

	json_rpc2(graph_url + sitemid + '?fields=id,name&access_token=' + access_token, function(d) {
		if(typeof d.id != 'undefined')
			fbu_info = d;
	}, 'callback');

	typeof FB != 'undefined' && FB.init({ appId  : app_id, status : true, cookie : false, xfbml  : false });
	_.act_ShowInvite = function(el){
		var	flag = el.getAttribute('act') == 'WineCooler' ? 1 : 0,
			flag_str = flag ? '扔' : '撈';
		typeof FB != 'undefined' && FB.ui({
			method:		'apprequests',
			message:	'每成功邀請一位好友加入, 每天就能多' + flag_str + '一個瓶子哦~',
			title:		'邀請好友就可以增加你的每日配額哦~',
			filters:	['app_non_users'],
			data:		'invite.' + sitemid + '.' + flag
		}, function(response){ });
	};

	_.rpc_host = rpc_host;
	_.sid = '5165615fsdfasd84asdf5a4s65d5f';
	_.call_UserDashboard({
		'sitemid':		sitemid,
		'time':			time,
		'key':			key,
		'request_ids':	request_ids,
		'access_token':	access_token
	}, _.call_BottleGetbottles);
}

try {
	if(document.onreadystatechange) {
		document.onreadystatechange = function(){ load_init(0); };
	} else
		setTimeout("load_init(1)", 1500);
} catch(err) {
	setTimeout("load_init(1)", 1500);
}
</script>
